Repository navigation
fix(id): count intra-interval revoke+re-add cycles in group churn watcher (#1847) - #4035
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a7558da8b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex P2 on PR #4035: a device revocation ends only the revoking account's grant in the fold, but the watcher removed the device from the whole group set, so another account's later re-add was counted as churn even though the device stayed authorized throughout. The watcher now tracks the authorizing accounts per device (from device events, and from the fold at baseline) and removes a device only when its last grant ends. Adds a regression test: four revoke+re-add cycles by a second account while the first account's grant stands produce no churn warning. For #1847.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87c31e071b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The evaluation reconciliation kept the device keys in step with the fold but preserved the tracked authorizing-account sets untouched. When an account that had authorized a device was removed from the group, its stale entry kept the device authorized through every later revoke by the remaining accounts, so genuine revoke+re-add cycles never counted as churn (Codex review on PR #4035). Refresh each active device's authorizing accounts from the fold (Projection::active_devices per member) during reconciliation, and pin it with serve_group_warnings_count_churn_after_a_grant_owner_is_removed: both accounts authorize, one is removed, then four cycles by the remaining account inside one interval fire the churn warning.
Fixes #1847 (queue task 5048).
Problem
GroupWarningWatcher::evaluatecounted re-adds by comparing the net device set between evaluations. A revoke + re-add cycle that completes inside one 60s evaluation interval leaves the net set unchanged, so it counted zero re-adds — a device cycling faster than once a minute could churn indefinitely without ever reaching the churn threshold.Change (
pkgs/id/src/commands/serve.rsonly)events_seen), tracks per-group authorization through the event stream, and counts an appliedDeviceOp::Addfor a device it has seen authorized before and that is not authorized at that point in the stream. Only events the foldAppliedcount — a refused authorization/revocation changes nothing.CHURN_THRESHOLD,CHURN_WINDOW_SECS, the evaluator's once-per-burst / re-arm semantics, the 60s interval, size warnings, and the startup pass are unchanged. Re-adds are still stamped with the evaluating pass's time and age out of the 24h window exactly as before.Tests
serve_group_warnings_fire_on_intra_interval_readd_churn: four revoke+re-add cycles written to the group log with no evaluation in between, then one evaluation, firesWarning::Churn { readds: 4 }.serve_group_warnings_fire_on_device_readd_churn(straddling cycles) covers the unchanged path: each cycle's add event is folded by the following evaluation and counted once.Need help on this PR? Tag
@codesmith-botwith what you need.